package main

import "strings"

func main() {
	reverseVowels("leetcode")
}

func reverseVowels(s string) string {
	sliceS := []byte(s)
	vowels := "aeiou"
	left := 0
	right := len(s)-1
	for  left < right  {
		if strings.Contains(vowels, string(s[left])) && strings.Contains(vowels, string(s[right])) {
			sliceS[left], sliceS[right] = sliceS[right], sliceS[left]
			left++
			right--
		}
		if !strings.Contains(vowels, string(s[left])) {
			left++
		}
		if !strings.Contains(vowels, string(s[right])) {
			right--
		}
	}
	return string(sliceS)
}
